package com.digital.smartgrow.controller.notice;

import com.digital.smartgrow.common.advice.Result;
import com.digital.smartgrow.dto.notice.WaitNoticePageDTO;
import com.digital.smartgrow.service.notice.WaitNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 通知 前端控制器
 * </p>
 *
 * @author sunyuechao
 * @since 2022-07-14
 */
@Api(tags = "通知")
@RestController
@RequestMapping("${context.prefix}/syc/waitNotice")
public class WaitNoticeController {

    @Autowired
    private WaitNoticeService waitNoticeService;

    @ApiOperation(value = "通知-分页查询")
    @PostMapping("/list")
    public Object getListByPage(@RequestBody WaitNoticePageDTO waitNoticePageDTO){
        return waitNoticeService.getListByPage(waitNoticePageDTO);
    }

    @ApiOperation(value = "通知-详情")
    @GetMapping("/{id}")
    public Object getInfo(@PathVariable Integer id){
        if (id == null) return Result.fail("id不能为空");
        return waitNoticeService.getInfo(id);
    }
//
//    @ApiOperation(value = "通知-删除")
//    @DeleteMapping("/{id}")
//    public Object removeById(@PathVariable Integer id){
//      if (id == null) return Result.fail("id不能为空");
//      return waitNoticeService.removeById(id);
//    }
//    @ApiOperation(value = "通知-新增")
//    @PostMapping()
//    public Object add( @RequestBody WaitNotice waitNotice){
//       return waitNoticeService.save(waitNotice);
//    }
//
//    @ApiOperation(value = "通知-编辑")
//    @PutMapping()
//    public Object edit(@RequestBody WaitNotice waitNotice){
//    if (waitNotice==null||waitNotice.getId() == null)
//       return Result.fail("id不能为空");
//       return waitNoticeService.updateById(waitNotice);
//    }
}
